train_output_path=/home/exps/fastspeech2_thorsten/inference
model_dir=$train_output_path
model=fastspeech2_thorsten_encoder
model_decoder=fastspeech2_thorsten_decoder
enable_dev_version=True

paddle2onnx \
    --model_dir ${model_dir} \
    --model_filename ${model}.pdmodel \
    --params_filename ${model}.pdiparams \
    --save_file ${train_output_path}/${model}.onnx \
    --opset_version 11 \
    --enable_dev_version ${enable_dev_version}

paddle2onnx \
    --model_dir ${model_dir} \
    --model_filename ${model_decoder}.pdmodel \
    --params_filename ${model_decoder}.pdiparams \
    --save_file ${train_output_path}/${model_decoder}.onnx \
    --opset_version 11 \
    --enable_dev_version ${enable_dev_version}


mv ${train_output_path}/${model}.onnx ${train_output_path}/${model_decoder}.onnx /home/